<template>
	<view class="page">
		<custom-header :title="title"/>
		<!-- #ifdef APP-PLUS -->
		<view style="height: 40px;"></view>
		<!-- #endif -->
		<view class="list-panel">
			<view style="color: red">提示：请等待附件上传完成，再点击保存，否则附件无法保存成功！</view>
			<template v-if="companyDataInfo.length > 0">
				<view class="item" v-for="(item, index) in companyDataInfo" :key="index">
					<view class="info">
						<view class="name">{{ item.label }}</view>
						<view class="upload" v-if="!uploadImage">
							<custom-upload-file  v-model="formData[item.key]" :isIcon="true" :iconSize="16" iconName="plus-circle"
								iconColor="#C6C6C6" />
						</view>
					</view>
					<view class="edit">
						<h-upload-image v-if="uploadImage" v-model="formData[item.key]"></h-upload-image>
						<file-list v-if="formData[item.key] && !uploadImage" v-model="formData[item.key]" :isDelete="true"></file-list>
					</view>
				</view>
			</template>
			<u-empty v-else mode="data" icon="/static/empty/data.png"></u-empty>
		</view>
		<view style="height: 100rpx;"></view>
		<view class="space-x-1 px-1 btn_position">
			<u-button :disabled="isSubmit" type="primary" text="保存" @click="onSubmit"></u-button>
		</view>
	</view>
</template>

<script>
// import CustomHeader from '@/pages/purchase/components/customHeader.vue';
import fileList from '@/pages/synergy/components/fileList.vue'
import APPTYPE from '@/config/appType.js';
export default {
	props: {},
	components: { 
		// CustomHeader, 
		fileList 
	},
	data() {
		return {
			APPTYPE: APPTYPE,
			companyDataInfo: [],
			isSubmit: false,
			formData: {},
			title: '',
			uploadImage: false
		}
	},
	watch: {
	},
	onLoad(options) {
		this.title = options.title || '附件信息';
		this.formData = JSON.parse(decodeURIComponent(options.formData)) || {};
		this.companyDataInfo = JSON.parse(decodeURIComponent(options.companyData)) || [];
		this.uploadImage = options.uploadImage? true : false;
	},
	created() {
	},
	methods: {
		onSubmit() {
			this.isSubmit = true;
			uni.$emit(this.APPTYPE.COMPANYDATA, this.formData);
			uni.navigateBack({
				delta: 1
			})
		},
	}
}
</script>

<style scoped lang="scss">
@import url("@/assets/inputStyle.scss");

// .sticky {
// 	padding: 20rpx;
// }

.list-panel {
	margin-top: 54px;
	padding: 20rpx 40rpx 40rpx;
	background: #fff;

	.item {
		padding: 40rpx 0;
		display: flex;
		flex-flow: column nowrap;
		border-bottom: 2rpx solid #F2F2F2;

		.info {
			margin-bottom: 32rpx;
			display: flex;
			flex-flow: row nowrap;
			align-items: center;
			justify-content: space-between;
			font-size: 16px;
			font-weight: 400;

			.name {
				color: #171717;
			}

			// .phone {
			// 	color: #7F7F7F;
			// }

		}
	}

	.item:last-child {
		border-bottom: none;
	}
}
</style>